package com.qeegoo.b2bautozityp.moudle.inquiry.view;

import com.qeegoo.b2bautozityp.R;
import com.qeegoo.b2bautozityp.databinding.ActivityInquiryListBinding;
import com.qeegoo.b2bautozityp.injector.component.DaggerInquiryListComponent;
import com.qeegoo.b2bautozityp.moudle.base.AppBar;
import com.qeegoo.b2bautozityp.moudle.base.BaseActivity;
import com.qeegoo.b2bautozityp.moudle.base.LazyLoadFragment;
import com.qeegoo.b2bautozityp.moudle.inquiry.adapter.InquiryListFragmentAdapter;
import com.qeegoo.b2bautozityp.widget.TabBarUtils;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by lining on 2017/9/28.
 */

public class InquiryListActivity extends BaseActivity<ActivityInquiryListBinding> {

    private String[] titles ={"待报价","已报价"};

    private List<LazyLoadFragment> fragments = new ArrayList<>();

    @Inject
    AppBar mAppbar;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_inquiry_list;
    }

    @Override
    protected void initInjector() {
        DaggerInquiryListComponent.builder().appComponent(getAppComponent()).activityComponent(getActivityComponent()).build().inject(this);
//       DaggerO
    }

    @Override
    protected void initViews() {
        initToolBar(mBinding.layoutInclude, mAppbar);

        fragments.add(InquiryListFragment.newInstance(0));
        fragments.add(InquiryListFragment.newInstance(1));
        mBinding.tabLayout.addTab(mBinding.tabLayout.newTab().setText(titles[0]), true);
        mBinding.tabLayout.addTab(mBinding.tabLayout.newTab().setText(titles[1]));

        InquiryListFragmentAdapter mFragmentAdapteradapter =
                new InquiryListFragmentAdapter(getSupportFragmentManager(), fragments, titles);
        mBinding.viewpager.setAdapter(mFragmentAdapteradapter);
        mBinding.tabLayout.setupWithViewPager(mBinding.viewpager);
        TabBarUtils.setIndicator(mBinding.tabLayout,60,60);
    }
}
